Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Copy node respect tethered nodes correctly #5350 #5358

Conversation

mhsdesign
Copy link
Member

Resolves: #5350

In case a leaf node that is tethered is copied, we un-tether it.
A migration flow migrateevents:migratecopytetherednode fixes this for previous cases.

In case a tethered node is attempted to be copied which has tethered childnodes determined by the parent nodetype we fail. This is not possible. What we dont do yet is determine this correctly and there are false positives:

we assume here that the child node is tethered because the grandparent specifies that.
this is not always fully correct and we could loosen the constraint by checking the node type schema

to correctly determine this, we have to evaluate the node type schema which is not available currently.
Upgrade instructions

Review instructions

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked with !!! and have upgrade-instructions

>  Node aggregate classifications do not match. Expected "regular", got "tethered".

Or a catchup will fail with

> The NodeName must be set if the Node is tethered
In case a leaf node that is tethered is copied, we un-tether it.
A migration `flow migrateevents:migratecopytetherednode` fixes this for previous cases.

In case a tethered node is attempted to be copied which has tethered childnodes determined by the parent nodetype we fail. This is not possible. What we dont do yet is determine this correctly and there are false positives:

> we assume here that the child node is tethered because the grandparent specifies that.
> this is not always fully correct and we could loosen the constraint by checking the node type schema

to correctly determine this, we have to evaluate the node type schema which is not available currently.
Comment on lines 51 to +56
public static function fromSubgraphAndStartNode(ContentSubgraphInterface $subgraph, Node $sourceNode): self
{
$childNodes = [];
return self::createSnapshotRecursively($subgraph, $sourceNode, true);
}

private static function createSnapshotRecursively(ContentSubgraphInterface $subgraph, Node $sourceNode, bool $firstLevel): self
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jup this looks ugly but it doesnt matter, this is just meant as a hotfix. In order to evaluate constraints correctly (64) and also copying of dimensions we have to move this logic to a command handler imo and create a serialised version of this stuff.

But first things first, hey at least copying is now a little les broken :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: I created an issue for that: #5359

@mhsdesign mhsdesign marked this pull request as draft November 12, 2024 17:06
@mhsdesign
Copy link
Member Author

Superseeded by #5371 we want copy nodes as a service instead :)

@mhsdesign mhsdesign closed this Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: CopyNodesRecursively vs Tethered nodes
2 participants